//
//  NSMutableData+ext.m
//  WanLian
//
//  Created by 123456 on 2019/1/8.
//  Copyright © 2019 wanlian. All rights reserved.
//

#import "NSMutableData+ext.h"

@implementation NSMutableData (ext)
- (void)appendInt:(int)num {
    Byte b1=num & 0xff;
    Byte b2=(num>>8) & 0xff;
    Byte b3=(num>>16) & 0xff;
    Byte b4=(num>>24) & 0xff;
    Byte byte[] = {b4,b3,b2,b1};
    [self appendBytes:byte length:4];
}
- (void)removeAllData {
    if (self.length > 0) {
        [self replaceBytesInRange:NSMakeRange(0, self.length) withBytes:NULL length:0];
    }
}
- (void)removeDataWithRange:(NSRange)range {
    if (self.length >= (range.location + range.length)) {
        
        [self replaceBytesInRange:range withBytes:NULL length:0];
    }
}
@end
